/*******************************************************************************
*              (c), Copyright 2001, Marvell International Ltd.                 *
* THIS CODE CONTAINS CONFIDENTIAL INFORMATION OF MARVELL SEMICONDUCTOR, INC.   *
* NO RIGHTS ARE GRANTED HEREIN UNDER ANY PATENT, MASK WORK RIGHT OR COPYRIGHT  *
* OF MARVELL OR ANY THIRD PARTY. MARVELL RESERVES THE RIGHT AT ITS SOLE        *
* DISCRETION TO REQUEST THAT THIS CODE BE IMMEDIATELY RETURNED TO MARVELL.     *
* THIS CODE IS PROVIDED "AS IS". MARVELL MAKES NO WARRANTIES, EXPRESSED,       *
* IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE.   *
********************************************************************************
* cpssDxChPortIfModeCfgBcat2Resource.c
*
* DESCRIPTION:
*       CPSS BC2 B0 resource tables.
*
*
* FILE REVISION NUMBER:
*       $Revision: 1 $
*******************************************************************************/
#include <cpss/extServices/private/prvCpssBindFunc.h>
#include <cpss/dxCh/dxChxGen/config/private/prvCpssDxChInfo.h>

#include <cpss/dxCh/dxChxGen/port/PortMapping/prvCpssDxChPortMappingShadowDB.h>
#include <cpss/dxCh/dxChxGen/port/private/prvCpssDxChPortIfModeCfgBcat2B0ResourceList.h>
#include <cpss/dxCh/dxChxGen/port/private/prvCpssDxChPortIfModeCfgBcat2B0ResourceTables.h>
#include <cpss/dxCh/dxChxGen/port/private/prvCpssDxChPortIfModeCfgResource.h>

#define UNUSED_PARAMETER(x) x = x
/*-------------------------------------------------------*
 * Bobcat2 B0 Generated Tables Start                     *
 *-------------------------------------------------------*/
PRV_CPSS_DXCH_SPEED_PLACE_STC prv_speedPlaceArr[] = 
{                                                
     { CPSS_PORT_SPEED_1000_E   ,   1000,   1 }
    ,{ CPSS_PORT_SPEED_2500_E   ,   2500,   2 }
    ,{ CPSS_PORT_SPEED_10000_E  ,  10000,   3 }
    ,{ CPSS_PORT_SPEED_11800_E  ,  12000,   4 }
    ,{ CPSS_PORT_SPEED_20000_E  ,  20000,   5 }
    ,{ CPSS_PORT_SPEED_40000_E  ,  40000,   6 }
    ,{ CPSS_PORT_SPEED_47200_E  ,  48000,   7 }
    ,{ CPSS_PORT_SPEED_100G_E   , 100000,   8 }
};                                         
                                           
PRV_CPSS_DXCH_CORECLOCK_PLACE_STC prv_coreClockPlaceArr[] = 
{    /* real cc, computation, idx */                 
     {      175,        175,   1 }
    ,{      250,        250,   2 }
    ,{      362,        360,   3 }
    ,{      400,        400,   4 }
    ,{      521,        520,   5 }
};                                         

/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_TxQDescriptorCredit : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_TxQDescriptorCredit_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,      3,      5,     12,     11,     19,     33,     32,     59 }
    ,{    250,      2,      3,      8,      7,     13,     23,     22,     42 }
    ,{    360,      2,      3,      7,      6,     10,     17,     16,     30 }
    ,{    400,      2,      3,      6,      6,      9,     15,     15,     27 }
    ,{    520,      2,      3,      5,      5,      8,     13,     12,     21 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_burstAlmostFullThreshold : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_burstAlmostFullThreshold_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,      2,      3,      7,      7,     11,     18,     21,     39 }
    ,{    250,      2,      2,      4,      5,      7,     12,     15,     27 }
    ,{    360,      2,      2,      4,      4,      6,      9,     11,     20 }
    ,{    400,      2,      2,      4,      4,      5,      8,     10,     18 }
    ,{    520,      2,      2,      3,      3,      4,      7,      8,     14 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_burstFullThreshold : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_burstFullThreshold_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,      3,      5,     12,     11,     19,     33,     32,     59 }
    ,{    250,      2,      3,      8,      7,     13,     23,     22,     42 }
    ,{    360,      2,      3,      7,      6,     10,     17,     16,     30 }
    ,{    400,      2,      3,      6,      6,      9,     15,     15,     27 }
    ,{    520,      2,      3,      5,      5,      8,     13,     12,     21 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_TxFIFOHeaderCreditThreshold : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_TxFIFOHeaderCreditThreshold_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,      5,     10,     49,     48,     96,    190,    185,    385 }
    ,{    250,      3,      8,     34,     33,     68,    134,    130,    270 }
    ,{    360,      2,      5,     24,     24,     47,     93,     90,    187 }
    ,{    400,      2,      5,     22,     21,     43,     84,     82,    169 }
    ,{    520,      2,      4,     18,     17,     33,     66,     63,    130 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_TxFIFOPayloadCreditThreshold : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_TxFIFOPayloadCreditThreshold_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,      7,     13,     58,     59,    113,    223,    224,    465 }
    ,{    250,      5,     11,     41,     41,     80,    157,    158,    326 }
    ,{    360,      4,      7,     29,     30,     56,    110,    110,    226 }
    ,{    400,      4,      7,     27,     27,     51,     99,    100,    205 }
    ,{    520,      4,      6,     22,     22,     40,     78,     77,    158 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXFIFO_SCDMA_PayloadStartTransmThreshold : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXFIFO_SCDMA_PayloadStartTransmThreshold_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,      2,      3,      9,     11,     17,     33,     39,     80 }
    ,{    250,      2,      3,      7,      8,     12,     23,     28,     56 }
    ,{    360,      2,      2,      5,      6,      9,     17,     20,     39 }
    ,{    400,      2,      2,      5,      6,      8,     15,     18,     36 }
    ,{    520,      2,      2,      4,      5,      7,     12,     14,     28 }
}; 


/*-----------------------------------------------------------------------------------*
 * ETH_TXFIFO_SCDMA_PayloadStartTransmThreshold : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 ETH_TXFIFO_SCDMA_PayloadStartTransmThreshold_Arr[6][9] = 
{ 
     {      0,   1000,   2500,  10000,  12000,  20000,  40000,  48000, 100000 }
    ,{    175,    240,    240,    240,    240,    240,    240,    240,    240 }
    ,{    250,    240,    240,    240,    240,    240,    240,    240,    240 }
    ,{    360,    240,    240,    240,    240,    240,    240,    240,    240 }
    ,{    400,    240,    240,    240,    240,    240,    240,    240,    240 }
    ,{    520,    240,    240,    240,    240,    240,    240,    240,    240 }
}; 


/*-------------------------------------------------------*
 * Bobcat2 B0 Generated Tables End                       *
 *-------------------------------------------------------*/


/*--------------------------------------------------------------*
 * BC2 TM Tables with granularity 1G start                      *
 *--------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_TxQDescriptorCredit_gran_1G : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_TxQDescriptorCredit_gran_1G_Arr[131][6] = 
{ 
     {      0,    175,    250,    360,    400,    520 }
    ,{   1000,      7,      6,      6,      6,      4 }
    ,{   2000,      9,      9,      8,      8,      6 }
    ,{   3000,     10,      9,      9,      9,      6 }
    ,{   4000,     11,     10,      9,      9,      6 }
    ,{   5000,     12,     11,     10,     10,      7 }
    ,{   6000,     13,     11,     11,     10,      7 }
    ,{   7000,     14,     12,     11,     10,      7 }
    ,{   8000,     15,     13,     11,     11,      8 }
    ,{   9000,     15,     13,     12,     11,      8 }
    ,{  10000,     16,     14,     12,     12,      8 }
    ,{  11000,     16,     14,     12,     12,      8 }
    ,{  12000,     18,     15,     13,     12,      9 }
    ,{  13000,     18,     15,     13,     13,      9 }
    ,{  14000,     19,     16,     13,     13,      9 }
    ,{  15000,     20,     16,     14,     13,      9 }
    ,{  16000,     21,     17,     14,     14,      9 }
    ,{  17000,     21,     17,     15,     14,     10 }
    ,{  18000,     22,     18,     15,     14,     10 }
    ,{  19000,     23,     18,     15,     15,     10 }
    ,{  20000,     23,     19,     16,     15,     11 }
    ,{  21000,     24,     19,     16,     15,     11 }
    ,{  22000,     25,     20,     16,     16,     11 }
    ,{  23000,     25,     20,     17,     16,     11 }
    ,{  24000,     26,     21,     18,     16,     12 }
    ,{  25000,     27,     21,     18,     16,     12 }
    ,{  26000,     28,     22,     18,     17,     12 }
    ,{  27000,     29,     22,     19,     17,     12 }
    ,{  28000,     29,     23,     19,     17,     13 }
    ,{  29000,     30,     24,     19,     18,     13 }
    ,{  30000,     31,     24,     19,     18,     13 }
    ,{  31000,     31,     24,     20,     18,     13 }
    ,{  32000,     33,     25,     20,     19,     14 }
    ,{  33000,     33,     26,     20,     19,     14 }
    ,{  34000,     33,     26,     21,     20,     14 }
    ,{  35000,     35,     27,     21,     20,     14 }
    ,{  36000,     35,     27,     21,     20,     14 }
    ,{  37000,     35,     28,     22,     21,     15 }
    ,{  38000,     36,     28,     23,     20,     15 }
    ,{  39000,     37,     29,     23,     21,     16 }
    ,{  40000,     37,     29,     23,     21,     16 }
    ,{  41000,     38,     30,     24,     22,     16 }
    ,{  42000,     39,     30,     24,     23,     16 }
    ,{  43000,     40,     31,     24,     22,     16 }
    ,{  44000,     41,     32,     24,     23,     17 }
    ,{  45000,     42,     31,     25,     23,     17 }
    ,{  46000,     43,     32,     25,     24,     17 }
    ,{  47000,     42,     33,     25,     24,     17 }
    ,{  48000,     43,     33,     25,     24,     17 }
    ,{  49000,     44,     34,     27,     24,     18 }
    ,{  50000,     45,     35,     27,     25,     18 }
    ,{  51000,     46,     34,     26,     25,     19 }
    ,{  52000,     46,     35,     27,     25,     19 }
    ,{  53000,     47,     36,     27,     25,     19 }
    ,{  54000,     46,     36,     28,     26,     19 }
    ,{  55000,     49,     37,     28,     26,     19 }
    ,{  56000,     48,     36,     29,     27,     20 }
    ,{  57000,     49,     37,     28,     27,     20 }
    ,{  58000,     50,     38,     30,     28,     20 }
    ,{  59000,     51,     38,     29,     27,     20 }
    ,{  60000,     52,     39,     30,     28,     20 }
    ,{  61000,     52,     40,     30,     28,     21 }
    ,{  62000,     53,     40,     31,     29,     22 }
    ,{  63000,     54,     41,     31,     29,     21 }
    ,{  64000,     55,     41,     31,     30,     21 }
    ,{  65000,     56,     42,     32,     29,     22 }
    ,{  66000,     57,     43,     32,     30,     22 }
    ,{  67000,     58,     43,     32,     30,     22 }
    ,{  68000,     58,     42,     33,     30,     23 }
    ,{  69000,     59,     43,     33,     31,     23 }
    ,{  70000,     58,     44,     34,     31,     23 }
    ,{  71000,     59,     44,     34,     32,     23 }
    ,{  72000,     59,     45,     35,     32,     23 }
    ,{  73000,     60,     46,     34,     32,     24 }
    ,{  74000,     61,     46,     36,     32,     24 }
    ,{  75000,     62,     47,     35,     33,     24 }
    ,{  76000,     63,     47,     35,     33,     24 }
    ,{  77000,     64,     48,     36,     33,     24 }
    ,{  78000,     64,     49,     36,     34,     25 }
    ,{  79000,     65,     48,     37,     34,     25 }
    ,{  80000,     66,     48,     37,     34,     25 }
    ,{  81000,     67,     49,     38,     35,     26 }
    ,{  82000,     68,     49,     38,     34,     26 }
    ,{  83000,     69,     50,     39,     35,     26 }
    ,{  84000,     69,     51,     38,     35,     26 }
    ,{  85000,     67,     51,     40,     36,     26 }
    ,{  86000,     68,     52,     39,     36,     27 }
    ,{  87000,     69,     52,     39,     36,     27 }
    ,{  88000,     70,     53,     40,     37,     27 }
    ,{  89000,     71,     54,     40,     37,     28 }
    ,{  90000,     71,     54,     40,     38,     28 }
    ,{  91000,     72,     55,     41,     38,     28 }
    ,{  92000,     73,     55,     41,     37,     28 }
    ,{  93000,     74,     56,     42,     38,     28 }
    ,{  94000,     75,     56,     42,     39,     29 }
    ,{  95000,     75,     57,     43,     38,     29 }
    ,{  96000,     76,     58,     42,     39,     30 }
    ,{  97000,     77,     56,     42,     39,     29 }
    ,{  98000,     78,     59,     44,     40,     30 }
    ,{  99000,     78,     57,     43,     40,     30 }
    ,{ 100000,     79,     58,     45,     40,     30 }
    ,{ 101000,     80,     58,     44,     41,     30 }
    ,{ 102000,     81,     59,     44,     41,     31 }
    ,{ 103000,     82,     60,     45,     42,     31 }
    ,{ 104000,     82,     60,     45,     42,     31 }
    ,{ 105000,     83,     61,     46,     42,     31 }
    ,{ 106000,     84,     61,     46,     43,     31 }
    ,{ 107000,     85,     62,     46,     43,     32 }
    ,{ 108000,     86,     62,     47,     42,     32 }
    ,{ 109000,     86,     63,     47,     43,     32 }
    ,{ 110000,     87,     64,     48,     43,     32 }
    ,{ 111000,     88,     64,     48,     43,     33 }
    ,{ 112000,     89,     65,     49,     44,     33 }
    ,{ 113000,     90,     65,     49,     44,     33 }
    ,{ 114000,     90,     66,     49,     45,     34 }
    ,{ 115000,     87,     66,     48,     45,     34 }
    ,{ 116000,     88,     67,     50,     45,     34 }
    ,{ 117000,     89,     68,     49,     46,     34 }
    ,{ 118000,     90,     68,     49,     46,     35 }
    ,{ 119000,     90,     69,     50,     46,     34 }
    ,{ 120000,     91,     69,     50,     47,     34 }
    ,{ 121000,     92,     70,     51,     47,     35 }
    ,{ 122000,     93,     70,     51,     48,     35 }
    ,{ 123000,     94,     71,     51,     48,     35 }
    ,{ 124000,     94,     69,     52,     47,     36 }
    ,{ 125000,     95,     69,     52,     49,     36 }
    ,{ 126000,     96,     70,     53,     49,     36 }
    ,{ 127000,     97,     71,     53,     48,     36 }
    ,{ 128000,     97,     71,     53,     50,     37 }
    ,{ 129000,     98,     72,     54,     49,     37 }
    ,{ 130000,     99,     72,     54,     49,     37 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_burstAlmostFullThreshold_gran_1G : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_burstAlmostFullThreshold_gran_1G_Arr[131][6] = 
{ 
     {      0,    175,    250,    360,    400,    520 }
    ,{   1000,      4,      4,      4,      4,      3 }
    ,{   2000,      5,      5,      5,      5,      3 }
    ,{   3000,      6,      5,      5,      5,      3 }
    ,{   4000,      6,      6,      5,      5,      4 }
    ,{   5000,      7,      6,      6,      5,      4 }
    ,{   6000,      7,      6,      6,      6,      4 }
    ,{   7000,      8,      7,      6,      6,      4 }
    ,{   8000,      8,      7,      6,      6,      4 }
    ,{   9000,      8,      7,      6,      6,      4 }
    ,{  10000,      9,      8,      7,      6,      5 }
    ,{  11000,      9,      8,      7,      7,      5 }
    ,{  12000,     10,      8,      7,      7,      5 }
    ,{  13000,     10,      8,      7,      7,      5 }
    ,{  14000,     10,      9,      7,      7,      5 }
    ,{  15000,     11,      9,      7,      7,      5 }
    ,{  16000,     11,      9,      8,      7,      5 }
    ,{  17000,     12,      9,      8,      8,      5 }
    ,{  18000,     12,     10,      8,      8,      6 }
    ,{  19000,     12,     10,      8,      8,      6 }
    ,{  20000,     13,     10,      8,      8,      6 }
    ,{  21000,     13,     11,      9,      8,      6 }
    ,{  22000,     13,     11,      9,      9,      6 }
    ,{  23000,     14,     11,      9,      9,      6 }
    ,{  24000,     14,     11,     10,      9,      6 }
    ,{  25000,     15,     12,     10,      9,      7 }
    ,{  26000,     15,     12,     10,      9,      7 }
    ,{  27000,     15,     12,     10,      9,      7 }
    ,{  28000,     15,     12,     10,     10,      7 }
    ,{  29000,     16,     13,     10,     10,      7 }
    ,{  30000,     17,     13,     11,     10,      7 }
    ,{  31000,     17,     13,     11,     10,      7 }
    ,{  32000,     18,     14,     11,     10,      7 }
    ,{  33000,     18,     14,     11,     10,      8 }
    ,{  34000,     18,     14,     11,     11,      8 }
    ,{  35000,     19,     14,     12,     11,      8 }
    ,{  36000,     19,     14,     12,     11,      8 }
    ,{  37000,     19,     15,     12,     11,      8 }
    ,{  38000,     20,     15,     12,     11,      8 }
    ,{  39000,     20,     16,     12,     11,      9 }
    ,{  40000,     20,     15,     13,     12,      9 }
    ,{  41000,     20,     16,     13,     12,      9 }
    ,{  42000,     21,     16,     13,     12,      9 }
    ,{  43000,     21,     17,     13,     12,      9 }
    ,{  44000,     22,     17,     13,     12,      9 }
    ,{  45000,     22,     17,     13,     12,      9 }
    ,{  46000,     23,     17,     14,     13,      9 }
    ,{  47000,     23,     18,     14,     13,      9 }
    ,{  48000,     23,     18,     14,     13,     10 }
    ,{  49000,     23,     18,     14,     13,     10 }
    ,{  50000,     24,     19,     14,     14,     10 }
    ,{  51000,     24,     18,     14,     14,     10 }
    ,{  52000,     25,     19,     14,     13,     10 }
    ,{  53000,     25,     19,     15,     14,     10 }
    ,{  54000,     25,     19,     15,     14,     10 }
    ,{  55000,     26,     20,     15,     14,     10 }
    ,{  56000,     26,     20,     16,     14,     11 }
    ,{  57000,     26,     20,     15,     15,     11 }
    ,{  58000,     27,     20,     16,     15,     11 }
    ,{  59000,     27,     21,     16,     15,     11 }
    ,{  60000,     28,     21,     16,     15,     11 }
    ,{  61000,     28,     21,     16,     15,     11 }
    ,{  62000,     29,     22,     17,     15,     12 }
    ,{  63000,     29,     22,     17,     16,     12 }
    ,{  64000,     29,     22,     17,     16,     12 }
    ,{  65000,     30,     23,     17,     16,     12 }
    ,{  66000,     30,     23,     17,     16,     12 }
    ,{  67000,     31,     23,     17,     16,     12 }
    ,{  68000,     31,     23,     18,     16,     12 }
    ,{  69000,     32,     23,     18,     17,     12 }
    ,{  70000,     31,     23,     18,     17,     12 }
    ,{  71000,     31,     24,     18,     17,     13 }
    ,{  72000,     32,     24,     19,     17,     13 }
    ,{  73000,     32,     24,     18,     17,     13 }
    ,{  74000,     33,     25,     19,     17,     13 }
    ,{  75000,     33,     25,     19,     18,     13 }
    ,{  76000,     34,     25,     19,     18,     13 }
    ,{  77000,     34,     26,     19,     18,     13 }
    ,{  78000,     34,     26,     20,     18,     13 }
    ,{  79000,     35,     25,     20,     18,     14 }
    ,{  80000,     35,     26,     20,     18,     14 }
    ,{  81000,     36,     26,     20,     19,     14 }
    ,{  82000,     36,     26,     21,     19,     14 }
    ,{  83000,     37,     27,     21,     19,     14 }
    ,{  84000,     37,     27,     20,     19,     14 }
    ,{  85000,     36,     27,     21,     19,     14 }
    ,{  86000,     36,     28,     21,     19,     14 }
    ,{  87000,     37,     28,     21,     20,     15 }
    ,{  88000,     37,     28,     21,     20,     15 }
    ,{  89000,     38,     29,     22,     20,     15 }
    ,{  90000,     38,     29,     22,     20,     15 }
    ,{  91000,     39,     29,     22,     20,     15 }
    ,{  92000,     39,     30,     22,     20,     15 }
    ,{  93000,     39,     30,     22,     20,     15 }
    ,{  94000,     40,     30,     23,     21,     16 }
    ,{  95000,     40,     31,     23,     21,     16 }
    ,{  96000,     41,     31,     22,     21,     16 }
    ,{  97000,     41,     30,     23,     21,     16 }
    ,{  98000,     42,     32,     24,     21,     16 }
    ,{  99000,     42,     31,     23,     22,     16 }
    ,{ 100000,     42,     31,     24,     22,     16 }
    ,{ 101000,     43,     31,     24,     22,     16 }
    ,{ 102000,     43,     32,     24,     22,     17 }
    ,{ 103000,     44,     32,     24,     22,     17 }
    ,{ 104000,     44,     32,     24,     23,     17 }
    ,{ 105000,     44,     32,     24,     23,     17 }
    ,{ 106000,     45,     33,     25,     23,     17 }
    ,{ 107000,     45,     33,     25,     23,     17 }
    ,{ 108000,     46,     33,     25,     23,     17 }
    ,{ 109000,     46,     34,     25,     23,     17 }
    ,{ 110000,     47,     34,     26,     23,     17 }
    ,{ 111000,     47,     34,     26,     23,     18 }
    ,{ 112000,     47,     35,     26,     23,     18 }
    ,{ 113000,     48,     35,     26,     24,     18 }
    ,{ 114000,     48,     35,     26,     24,     18 }
    ,{ 115000,     47,     36,     26,     24,     18 }
    ,{ 116000,     47,     36,     27,     24,     18 }
    ,{ 117000,     48,     36,     26,     24,     18 }
    ,{ 118000,     48,     36,     26,     25,     19 }
    ,{ 119000,     48,     37,     27,     25,     18 }
    ,{ 120000,     49,     37,     27,     25,     19 }
    ,{ 121000,     49,     37,     27,     25,     19 }
    ,{ 122000,     50,     38,     27,     26,     19 }
    ,{ 123000,     50,     38,     28,     26,     19 }
    ,{ 124000,     50,     37,     28,     25,     19 }
    ,{ 125000,     51,     37,     28,     26,     19 }
    ,{ 126000,     51,     37,     28,     26,     19 }
    ,{ 127000,     52,     38,     28,     26,     20 }
    ,{ 128000,     52,     38,     29,     27,     20 }
    ,{ 129000,     52,     38,     29,     26,     20 }
    ,{ 130000,     53,     39,     29,     26,     20 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_burstFullThreshold_gran_1G : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_burstFullThreshold_gran_1G_Arr[131][6] = 
{ 
     {      0,    175,    250,    360,    400,    520 }
    ,{   1000,      7,      6,      6,      6,      4 }
    ,{   2000,      9,      9,      8,      8,      6 }
    ,{   3000,     10,      9,      9,      9,      6 }
    ,{   4000,     11,     10,      9,      9,      6 }
    ,{   5000,     12,     11,     10,     10,      7 }
    ,{   6000,     13,     11,     11,     10,      7 }
    ,{   7000,     14,     12,     11,     10,      7 }
    ,{   8000,     15,     13,     11,     11,      8 }
    ,{   9000,     15,     13,     12,     11,      8 }
    ,{  10000,     16,     14,     12,     12,      8 }
    ,{  11000,     16,     14,     12,     12,      8 }
    ,{  12000,     18,     15,     13,     12,      9 }
    ,{  13000,     18,     15,     13,     13,      9 }
    ,{  14000,     19,     16,     13,     13,      9 }
    ,{  15000,     20,     16,     14,     13,      9 }
    ,{  16000,     21,     17,     14,     14,      9 }
    ,{  17000,     21,     17,     15,     14,     10 }
    ,{  18000,     22,     18,     15,     14,     10 }
    ,{  19000,     23,     18,     15,     15,     10 }
    ,{  20000,     23,     19,     16,     15,     11 }
    ,{  21000,     24,     19,     16,     15,     11 }
    ,{  22000,     25,     20,     16,     16,     11 }
    ,{  23000,     25,     20,     17,     16,     11 }
    ,{  24000,     26,     21,     18,     16,     12 }
    ,{  25000,     27,     21,     18,     16,     12 }
    ,{  26000,     28,     22,     18,     17,     12 }
    ,{  27000,     29,     22,     19,     17,     12 }
    ,{  28000,     29,     23,     19,     17,     13 }
    ,{  29000,     30,     24,     19,     18,     13 }
    ,{  30000,     31,     24,     19,     18,     13 }
    ,{  31000,     31,     24,     20,     18,     13 }
    ,{  32000,     33,     25,     20,     19,     14 }
    ,{  33000,     33,     26,     20,     19,     14 }
    ,{  34000,     33,     26,     21,     20,     14 }
    ,{  35000,     35,     27,     21,     20,     14 }
    ,{  36000,     35,     27,     21,     20,     14 }
    ,{  37000,     35,     28,     22,     21,     15 }
    ,{  38000,     36,     28,     23,     20,     15 }
    ,{  39000,     37,     29,     23,     21,     16 }
    ,{  40000,     37,     29,     23,     21,     16 }
    ,{  41000,     38,     30,     24,     22,     16 }
    ,{  42000,     39,     30,     24,     23,     16 }
    ,{  43000,     40,     31,     24,     22,     16 }
    ,{  44000,     41,     32,     24,     23,     17 }
    ,{  45000,     42,     31,     25,     23,     17 }
    ,{  46000,     43,     32,     25,     24,     17 }
    ,{  47000,     42,     33,     25,     24,     17 }
    ,{  48000,     43,     33,     25,     24,     17 }
    ,{  49000,     44,     34,     27,     24,     18 }
    ,{  50000,     45,     35,     27,     25,     18 }
    ,{  51000,     46,     34,     26,     25,     19 }
    ,{  52000,     46,     35,     27,     25,     19 }
    ,{  53000,     47,     36,     27,     25,     19 }
    ,{  54000,     46,     36,     28,     26,     19 }
    ,{  55000,     49,     37,     28,     26,     19 }
    ,{  56000,     48,     36,     29,     27,     20 }
    ,{  57000,     49,     37,     28,     27,     20 }
    ,{  58000,     50,     38,     30,     28,     20 }
    ,{  59000,     51,     38,     29,     27,     20 }
    ,{  60000,     52,     39,     30,     28,     20 }
    ,{  61000,     52,     40,     30,     28,     21 }
    ,{  62000,     53,     40,     31,     29,     22 }
    ,{  63000,     54,     41,     31,     29,     21 }
    ,{  64000,     55,     41,     31,     30,     21 }
    ,{  65000,     56,     42,     32,     29,     22 }
    ,{  66000,     57,     43,     32,     30,     22 }
    ,{  67000,     58,     43,     32,     30,     22 }
    ,{  68000,     58,     42,     33,     30,     23 }
    ,{  69000,     59,     43,     33,     31,     23 }
    ,{  70000,     58,     44,     34,     31,     23 }
    ,{  71000,     59,     44,     34,     32,     23 }
    ,{  72000,     59,     45,     35,     32,     23 }
    ,{  73000,     60,     46,     34,     32,     24 }
    ,{  74000,     61,     46,     36,     32,     24 }
    ,{  75000,     62,     47,     35,     33,     24 }
    ,{  76000,     63,     47,     35,     33,     24 }
    ,{  77000,     64,     48,     36,     33,     24 }
    ,{  78000,     64,     49,     36,     34,     25 }
    ,{  79000,     65,     48,     37,     34,     25 }
    ,{  80000,     66,     48,     37,     34,     25 }
    ,{  81000,     67,     49,     38,     35,     26 }
    ,{  82000,     68,     49,     38,     34,     26 }
    ,{  83000,     69,     50,     39,     35,     26 }
    ,{  84000,     69,     51,     38,     35,     26 }
    ,{  85000,     67,     51,     40,     36,     26 }
    ,{  86000,     68,     52,     39,     36,     27 }
    ,{  87000,     69,     52,     39,     36,     27 }
    ,{  88000,     70,     53,     40,     37,     27 }
    ,{  89000,     71,     54,     40,     37,     28 }
    ,{  90000,     71,     54,     40,     38,     28 }
    ,{  91000,     72,     55,     41,     38,     28 }
    ,{  92000,     73,     55,     41,     37,     28 }
    ,{  93000,     74,     56,     42,     38,     28 }
    ,{  94000,     75,     56,     42,     39,     29 }
    ,{  95000,     75,     57,     43,     38,     29 }
    ,{  96000,     76,     58,     42,     39,     30 }
    ,{  97000,     77,     56,     42,     39,     29 }
    ,{  98000,     78,     59,     44,     40,     30 }
    ,{  99000,     78,     57,     43,     40,     30 }
    ,{ 100000,     79,     58,     45,     40,     30 }
    ,{ 101000,     80,     58,     44,     41,     30 }
    ,{ 102000,     81,     59,     44,     41,     31 }
    ,{ 103000,     82,     60,     45,     42,     31 }
    ,{ 104000,     82,     60,     45,     42,     31 }
    ,{ 105000,     83,     61,     46,     42,     31 }
    ,{ 106000,     84,     61,     46,     43,     31 }
    ,{ 107000,     85,     62,     46,     43,     32 }
    ,{ 108000,     86,     62,     47,     42,     32 }
    ,{ 109000,     86,     63,     47,     43,     32 }
    ,{ 110000,     87,     64,     48,     43,     32 }
    ,{ 111000,     88,     64,     48,     43,     33 }
    ,{ 112000,     89,     65,     49,     44,     33 }
    ,{ 113000,     90,     65,     49,     44,     33 }
    ,{ 114000,     90,     66,     49,     45,     34 }
    ,{ 115000,     87,     66,     48,     45,     34 }
    ,{ 116000,     88,     67,     50,     45,     34 }
    ,{ 117000,     89,     68,     49,     46,     34 }
    ,{ 118000,     90,     68,     49,     46,     35 }
    ,{ 119000,     90,     69,     50,     46,     34 }
    ,{ 120000,     91,     69,     50,     47,     34 }
    ,{ 121000,     92,     70,     51,     47,     35 }
    ,{ 122000,     93,     70,     51,     48,     35 }
    ,{ 123000,     94,     71,     51,     48,     35 }
    ,{ 124000,     94,     69,     52,     47,     36 }
    ,{ 125000,     95,     69,     52,     49,     36 }
    ,{ 126000,     96,     70,     53,     49,     36 }
    ,{ 127000,     97,     71,     53,     48,     36 }
    ,{ 128000,     97,     71,     53,     50,     37 }
    ,{ 129000,     98,     72,     54,     49,     37 }
    ,{ 130000,     99,     72,     54,     49,     37 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_TxFIFOHeaderCreditThreshold_gran_1G : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_TxFIFOHeaderCreditThreshold_gran_1G_Arr[131][6] = 
{ 
     {      0,    175,    250,    360,    400,    520 }
    ,{   1000,      6,      4,      4,      4,      2 }
    ,{   2000,     10,      8,      5,      5,      5 }
    ,{   3000,     16,     11,      8,      8,      5 }
    ,{   4000,     21,     16,     11,     10,      8 }
    ,{   5000,     25,     19,     14,     13,     10 }
    ,{   6000,     30,     22,     17,     13,     11 }
    ,{   7000,     34,     25,     19,     16,     13 }
    ,{   8000,     40,     28,     19,     19,     14 }
    ,{   9000,     46,     33,     22,     19,     16 }
    ,{  10000,     50,     34,     25,     22,     19 }
    ,{  11000,     53,     37,     28,     25,     19 }
    ,{  12000,     58,     41,     29,     27,     22 }
    ,{  13000,     64,     45,     32,     28,     21 }
    ,{  14000,     68,     50,     33,     31,     25 }
    ,{  15000,     72,     52,     35,     33,     27 }
    ,{  16000,     79,     54,     39,     36,     27 }
    ,{  17000,     82,     58,     42,     36,     30 }
    ,{  18000,     88,     62,     45,     40,     30 }
    ,{  19000,     93,     65,     46,     42,     33 }
    ,{  20000,     98,     68,     47,     43,     33 }
    ,{  21000,    102,     71,     51,     45,     36 }
    ,{  22000,    106,     76,     54,     49,     36 }
    ,{  23000,    111,     78,     56,     50,     38 }
    ,{  24000,    115,     81,     59,     52,     41 }
    ,{  25000,    120,     86,     59,     53,     43 }
    ,{  26000,    127,     89,     62,     55,     45 }
    ,{  27000,    132,     92,     64,     58,     45 }
    ,{  28000,    136,     96,     67,     60,     46 }
    ,{  29000,    141,     99,     68,     62,     48 }
    ,{  30000,    145,    102,     70,     64,     50 }
    ,{  31000,    150,    104,     73,     66,     52 }
    ,{  32000,    155,    108,     77,     68,     54 }
    ,{  33000,    160,    111,     78,     70,     54 }
    ,{  34000,    163,    114,     80,     72,     55 }
    ,{  35000,    169,    118,     83,     76,     57 }
    ,{  36000,    173,    123,     86,     76,     59 }
    ,{  37000,    178,    125,     88,     80,     61 }
    ,{  38000,    183,    130,     91,     82,     63 }
    ,{  39000,    187,    133,     93,     84,     64 }
    ,{  40000,    192,    136,     95,     86,     66 }
    ,{  41000,    196,    140,     98,     88,     67 }
    ,{  42000,    201,    143,    100,     90,     69 }
    ,{  43000,    206,    146,    102,     92,     70 }
    ,{  44000,    211,    149,    103,     95,     71 }
    ,{  45000,    216,    152,    105,     96,     75 }
    ,{  46000,    220,    156,    107,     99,     77 }
    ,{  47000,    226,    159,    110,    100,     77 }
    ,{  48000,    230,    162,    112,    102,     78 }
    ,{  49000,    235,    166,    114,    103,     82 }
    ,{  50000,    240,    169,    117,    107,     82 }
    ,{  51000,    245,    171,    121,    107,     83 }
    ,{  52000,    250,    175,    123,    109,     86 }
    ,{  53000,    254,    178,    126,    112,     88 }
    ,{  54000,    259,    182,    128,    114,     89 }
    ,{  55000,    264,    185,    130,    116,     91 }
    ,{  56000,    268,    188,    133,    118,     93 }
    ,{  57000,    273,    191,    134,    120,     94 }
    ,{  58000,    278,    195,    137,    122,     96 }
    ,{  59000,    282,    198,    139,    126,     97 }
    ,{  60000,    287,    201,    141,    128,     99 }
    ,{  61000,    292,    205,    144,    130,    100 }
    ,{  62000,    297,    208,    146,    132,    103 }
    ,{  63000,    302,    211,    149,    134,    103 }
    ,{  64000,    306,    215,    150,    136,    103 }
    ,{  65000,    311,    218,    153,    138,    105 }
    ,{  66000,    316,    221,    155,    140,    107 }
    ,{  67000,    321,    225,    158,    142,    108 }
    ,{  68000,    325,    228,    160,    144,    110 }
    ,{  69000,    330,    232,    162,    146,    111 }
    ,{  70000,    333,    235,    165,    148,    113 }
    ,{  71000,    338,    239,    167,    151,    115 }
    ,{  72000,    342,    242,    169,    153,    117 }
    ,{  73000,    347,    245,    171,    155,    118 }
    ,{  74000,    352,    249,    174,    157,    120 }
    ,{  75000,    357,    252,    175,    159,    121 }
    ,{  76000,    361,    255,    178,    161,    125 }
    ,{  77000,    366,    259,    180,    163,    126 }
    ,{  78000,    371,    262,    182,    165,    128 }
    ,{  79000,    376,    265,    184,    167,    130 }
    ,{  80000,    380,    268,    187,    168,    131 }
    ,{  81000,    385,    271,    189,    171,    133 }
    ,{  82000,    390,    275,    191,    172,    135 }
    ,{  83000,    395,    278,    194,    174,    136 }
    ,{  84000,    399,    282,    196,    177,    137 }
    ,{  85000,    405,    285,    198,    179,    139 }
    ,{  86000,    410,    288,    200,    181,    140 }
    ,{  87000,    415,    292,    203,    183,    142 }
    ,{  88000,    419,    295,    205,    185,    144 }
    ,{  89000,    424,    298,    207,    187,    145 }
    ,{  90000,    429,    302,    210,    189,    147 }
    ,{  91000,    434,    305,    212,    191,    149 }
    ,{  92000,    438,    308,    214,    193,    150 }
    ,{  93000,    443,    312,    217,    195,    151 }
    ,{  94000,    448,    315,    219,    197,    153 }
    ,{  95000,    453,    318,    221,    199,    155 }
    ,{  96000,    457,    322,    224,    201,    157 }
    ,{  97000,    462,    323,    226,    203,    158 }
    ,{  98000,    467,    328,    228,    206,    160 }
    ,{  99000,    472,    330,    231,    208,    161 }
    ,{ 100000,    476,    333,    233,    210,    163 }
    ,{ 101000,    481,    336,    236,    212,    164 }
    ,{ 102000,    486,    339,    238,    214,    166 }
    ,{ 103000,    491,    343,    240,    216,    168 }
    ,{ 104000,    495,    346,    243,    218,    169 }
    ,{ 105000,    500,    349,    245,    220,    170 }
    ,{ 106000,    505,    353,    247,    222,    171 }
    ,{ 107000,    510,    356,    250,    224,    173 }
    ,{ 108000,    514,    359,    252,    227,    175 }
    ,{ 109000,    519,    363,    254,    229,    176 }
    ,{ 110000,    524,    366,    257,    231,    178 }
    ,{ 111000,    529,    369,    259,    233,    179 }
    ,{ 112000,    534,    373,    261,    235,    181 }
    ,{ 113000,    538,    376,    264,    237,    183 }
    ,{ 114000,    543,    379,    266,    239,    184 }
    ,{ 115000,    547,    383,    268,    241,    186 }
    ,{ 116000,    551,    386,    271,    244,    188 }
    ,{ 117000,    556,    389,    272,    246,    189 }
    ,{ 118000,    561,    393,    275,    248,    191 }
    ,{ 119000,    566,    396,    277,    250,    192 }
    ,{ 120000,    570,    399,    279,    252,    194 }
    ,{ 121000,    575,    403,    282,    254,    195 }
    ,{ 122000,    580,    406,    284,    256,    197 }
    ,{ 123000,    585,    409,    286,    258,    198 }
    ,{ 124000,    589,    414,    289,    260,    200 }
    ,{ 125000,    594,    417,    291,    262,    202 }
    ,{ 126000,    599,    420,    293,    265,    203 }
    ,{ 127000,    604,    424,    296,    266,    205 }
    ,{ 128000,    608,    427,    298,    269,    206 }
    ,{ 129000,    613,    430,    300,    270,    208 }
    ,{ 130000,    618,    434,    303,    272,    210 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXDMA_SCDMA_TxFIFOPayloadCreditThreshold_gran_1G : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXDMA_SCDMA_TxFIFOPayloadCreditThreshold_gran_1G_Arr[131][6] = 
{ 
     {      0,    175,    250,    360,    400,    520 }
    ,{   1000,      8,      6,      6,      6,      4 }
    ,{   2000,     13,     11,      7,      7,      7 }
    ,{   3000,     20,     14,     11,     11,      7 }
    ,{   4000,     26,     20,     14,     13,     11 }
    ,{   5000,     30,     23,     17,     16,     13 }
    ,{   6000,     36,     27,     21,     17,     14 }
    ,{   7000,     41,     30,     23,     20,     16 }
    ,{   8000,     48,     34,     24,     23,     18 }
    ,{   9000,     55,     39,     27,     24,     20 }
    ,{  10000,     59,     41,     30,     27,     23 }
    ,{  11000,     63,     45,     34,     30,     23 }
    ,{  12000,     69,     49,     35,     33,     27 }
    ,{  13000,     76,     54,     38,     34,     26 }
    ,{  14000,     80,     59,     40,     37,     30 }
    ,{  15000,     85,     62,     42,     40,     32 }
    ,{  16000,     93,     64,     47,     43,     33 }
    ,{  17000,     97,     69,     50,     43,     36 }
    ,{  18000,    104,     73,     53,     48,     36 }
    ,{  19000,    109,     77,     55,     50,     40 }
    ,{  20000,    115,     80,     56,     51,     40 }
    ,{  21000,    120,     84,     60,     54,     43 }
    ,{  22000,    125,     90,     64,     58,     43 }
    ,{  23000,    130,     92,     66,     59,     46 }
    ,{  24000,    135,     96,     70,     62,     49 }
    ,{  25000,    141,    101,     70,     63,     51 }
    ,{  26000,    149,    105,     73,     65,     53 }
    ,{  27000,    155,    108,     76,     69,     54 }
    ,{  28000,    159,    113,     79,     71,     55 }
    ,{  29000,    165,    116,     81,     73,     57 }
    ,{  30000,    170,    120,     83,     76,     59 }
    ,{  31000,    176,    122,     86,     78,     62 }
    ,{  32000,    181,    127,     91,     80,     64 }
    ,{  33000,    187,    131,     92,     83,     64 }
    ,{  34000,    191,    134,     94,     85,     65 }
    ,{  35000,    198,    139,     98,     89,     68 }
    ,{  36000,    203,    144,    101,     90,     70 }
    ,{  37000,    208,    147,    104,     94,     72 }
    ,{  38000,    214,    152,    107,     96,     75 }
    ,{  39000,    219,    156,    109,     99,     76 }
    ,{  40000,    225,    159,    112,    101,     78 }
    ,{  41000,    230,    164,    115,    104,     79 }
    ,{  42000,    235,    167,    117,    106,     82 }
    ,{  43000,    241,    171,    120,    108,     83 }
    ,{  44000,    247,    175,    121,    112,     84 }
    ,{  45000,    253,    178,    124,    113,     88 }
    ,{  46000,    257,    183,    126,    116,     91 }
    ,{  47000,    264,    186,    129,    118,     91 }
    ,{  48000,    269,    190,    132,    120,     92 }
    ,{  49000,    275,    194,    134,    121,     96 }
    ,{  50000,    281,    198,    137,    126,     97 }
    ,{  51000,    286,    200,    142,    126,     98 }
    ,{  52000,    292,    205,    144,    128,    101 }
    ,{  53000,    297,    208,    148,    132,    103 }
    ,{  54000,    303,    213,    150,    134,    105 }
    ,{  55000,    308,    217,    152,    136,    107 }
    ,{  56000,    313,    220,    156,    139,    109 }
    ,{  57000,    319,    224,    157,    141,    111 }
    ,{  58000,    325,    228,    161,    143,    113 }
    ,{  59000,    330,    232,    163,    148,    114 }
    ,{  60000,    335,    235,    165,    150,    116 }
    ,{  61000,    341,    240,    169,    152,    118 }
    ,{  62000,    347,    243,    171,    155,    121 }
    ,{  63000,    353,    247,    174,    157,    121 }
    ,{  64000,    357,    251,    176,    159,    121 }
    ,{  65000,    363,    255,    179,    162,    124 }
    ,{  66000,    369,    259,    182,    164,    126 }
    ,{  67000,    375,    263,    185,    166,    127 }
    ,{  68000,    380,    267,    187,    169,    129 }
    ,{  69000,    385,    271,    190,    171,    131 }
    ,{  70000,    389,    275,    193,    173,    133 }
    ,{  71000,    395,    279,    195,    177,    135 }
    ,{  72000,    400,    283,    198,    179,    137 }
    ,{  73000,    406,    286,    200,    181,    139 }
    ,{  74000,    411,    291,    204,    184,    141 }
    ,{  75000,    417,    295,    205,    186,    142 }
    ,{  76000,    422,    298,    208,    188,    147 }
    ,{  77000,    428,    303,    211,    191,    148 }
    ,{  78000,    433,    306,    213,    193,    150 }
    ,{  79000,    439,    310,    216,    196,    152 }
    ,{  80000,    444,    313,    219,    197,    154 }
    ,{  81000,    450,    317,    221,    200,    156 }
    ,{  82000,    456,    321,    224,    202,    158 }
    ,{  83000,    461,    325,    227,    204,    159 }
    ,{  84000,    466,    329,    229,    207,    161 }
    ,{  85000,    473,    333,    232,    210,    163 }
    ,{  86000,    479,    337,    234,    212,    164 }
    ,{  87000,    484,    341,    238,    214,    166 }
    ,{  88000,    489,    345,    240,    217,    169 }
    ,{  89000,    495,    348,    242,    219,    170 }
    ,{  90000,    501,    353,    246,    221,    172 }
    ,{  91000,    507,    356,    248,    224,    174 }
    ,{  92000,    511,    360,    250,    226,    176 }
    ,{  93000,    517,    364,    254,    228,    177 }
    ,{  94000,    523,    368,    256,    231,    179 }
    ,{  95000,    529,    371,    259,    233,    182 }
    ,{  96000,    533,    376,    262,    235,    184 }
    ,{  97000,    539,    378,    264,    238,    185 }
    ,{  98000,    545,    383,    267,    241,    187 }
    ,{  99000,    551,    386,    270,    243,    189 }
    ,{ 100000,    556,    389,    272,    246,    191 }
    ,{ 101000,    561,    393,    276,    248,    192 }
    ,{ 102000,    567,    396,    278,    250,    194 }
    ,{ 103000,    573,    401,    281,    253,    197 }
    ,{ 104000,    578,    404,    284,    255,    198 }
    ,{ 105000,    584,    408,    286,    257,    199 }
    ,{ 106000,    589,    412,    289,    260,    200 }
    ,{ 107000,    595,    416,    292,    262,    203 }
    ,{ 108000,    600,    420,    295,    265,    205 }
    ,{ 109000,    606,    424,    297,    268,    206 }
    ,{ 110000,    611,    428,    300,    270,    209 }
    ,{ 111000,    617,    431,    303,    272,    210 }
    ,{ 112000,    623,    436,    305,    275,    212 }
    ,{ 113000,    628,    439,    308,    277,    214 }
    ,{ 114000,    634,    443,    311,    279,    216 }
    ,{ 115000,    638,    447,    313,    282,    218 }
    ,{ 116000,    643,    451,    317,    285,    220 }
    ,{ 117000,    649,    454,    318,    287,    221 }
    ,{ 118000,    655,    459,    321,    290,    224 }
    ,{ 119000,    660,    463,    324,    292,    225 }
    ,{ 120000,    665,    466,    326,    295,    227 }
    ,{ 121000,    671,    471,    329,    297,    228 }
    ,{ 122000,    677,    474,    332,    299,    231 }
    ,{ 123000,    683,    478,    334,    302,    232 }
    ,{ 124000,    687,    483,    338,    304,    234 }
    ,{ 125000,    693,    487,    340,    306,    236 }
    ,{ 126000,    699,    490,    342,    310,    238 }
    ,{ 127000,    705,    495,    346,    311,    240 }
    ,{ 128000,    709,    498,    348,    314,    241 }
    ,{ 129000,    715,    502,    351,    316,    244 }
    ,{ 130000,    721,    507,    354,    318,    246 }
}; 


/*-----------------------------------------------------------------------------------*
 * TXFIFO_SCDMA_PayloadStartTransmThreshold_gran_1G : core clock (MHz) x  speed (Mbps)
 *-----------------------------------------------------------------------------------*/
GT_U32 TXFIFO_SCDMA_PayloadStartTransmThreshold_gran_1G_Arr[131][6] = 
{ 
     {      0,    175,    250,    360,    400,    520 }
    ,{   1000,      2,      2,      2,      2,      2 }
    ,{   2000,      3,      3,      2,      2,      2 }
    ,{   3000,      4,      3,      3,      3,      2 }
    ,{   4000,      5,      4,      3,      3,      3 }
    ,{   5000,      5,      4,      3,      3,      3 }
    ,{   6000,      6,      5,      4,      4,      3 }
    ,{   7000,      7,      5,      4,      4,      3 }
    ,{   8000,      8,      6,      5,      4,      4 }
    ,{   9000,      9,      6,      5,      5,      4 }
    ,{  10000,      9,      7,      5,      5,      4 }
    ,{  11000,     10,      8,      6,      5,      4 }
    ,{  12000,     11,      8,      6,      6,      5 }
    ,{  13000,     12,      9,      6,      6,      5 }
    ,{  14000,     12,      9,      7,      6,      5 }
    ,{  15000,     13,     10,      7,      7,      5 }
    ,{  16000,     14,     10,      8,      7,      6 }
    ,{  17000,     15,     11,      8,      7,      6 }
    ,{  18000,     16,     11,      8,      8,      6 }
    ,{  19000,     16,     12,      9,      8,      7 }
    ,{  20000,     17,     12,      9,      8,      7 }
    ,{  21000,     18,     13,      9,      9,      7 }
    ,{  22000,     19,     14,     10,      9,      7 }
    ,{  23000,     19,     14,     10,      9,      8 }
    ,{  24000,     20,     15,     11,     10,      8 }
    ,{  25000,     21,     15,     11,     10,      8 }
    ,{  26000,     22,     16,     11,     10,      8 }
    ,{  27000,     23,     16,     12,     11,      9 }
    ,{  28000,     23,     17,     12,     11,      9 }
    ,{  29000,     24,     17,     13,     11,      9 }
    ,{  30000,     25,     18,     13,     12,      9 }
    ,{  31000,     26,     18,     13,     12,     10 }
    ,{  32000,     26,     19,     14,     12,     10 }
    ,{  33000,     27,     20,     14,     13,     10 }
    ,{  34000,     28,     20,     14,     13,     10 }
    ,{  35000,     29,     21,     15,     13,     11 }
    ,{  36000,     30,     21,     15,     14,     11 }
    ,{  37000,     30,     22,     16,     14,     11 }
    ,{  38000,     31,     22,     16,     14,     12 }
    ,{  39000,     32,     23,     16,     15,     12 }
    ,{  40000,     33,     23,     17,     15,     12 }
    ,{  41000,     34,     24,     17,     16,     12 }
    ,{  42000,     34,     24,     17,     16,     13 }
    ,{  43000,     35,     25,     18,     16,     13 }
    ,{  44000,     36,     26,     18,     17,     13 }
    ,{  45000,     37,     26,     19,     17,     13 }
    ,{  46000,     37,     27,     19,     17,     14 }
    ,{  47000,     38,     27,     19,     18,     14 }
    ,{  48000,     39,     28,     20,     18,     14 }
    ,{  49000,     40,     28,     20,     18,     14 }
    ,{  50000,     41,     29,     20,     19,     15 }
    ,{  51000,     41,     29,     21,     19,     15 }
    ,{  52000,     42,     30,     21,     19,     15 }
    ,{  53000,     43,     30,     22,     20,     15 }
    ,{  54000,     44,     31,     22,     20,     16 }
    ,{  55000,     44,     32,     22,     20,     16 }
    ,{  56000,     45,     32,     23,     21,     16 }
    ,{  57000,     46,     33,     23,     21,     17 }
    ,{  58000,     47,     33,     24,     21,     17 }
    ,{  59000,     48,     34,     24,     22,     17 }
    ,{  60000,     48,     34,     24,     22,     17 }
    ,{  61000,     49,     35,     25,     22,     18 }
    ,{  62000,     50,     35,     25,     23,     18 }
    ,{  63000,     51,     36,     25,     23,     18 }
    ,{  64000,     51,     36,     26,     23,     18 }
    ,{  65000,     52,     37,     26,     24,     19 }
    ,{  66000,     53,     38,     27,     24,     19 }
    ,{  67000,     54,     38,     27,     24,     19 }
    ,{  68000,     55,     39,     27,     25,     19 }
    ,{  69000,     55,     39,     28,     25,     20 }
    ,{  70000,     56,     40,     28,     25,     20 }
    ,{  71000,     57,     40,     28,     26,     20 }
    ,{  72000,     58,     41,     29,     26,     20 }
    ,{  73000,     59,     41,     29,     26,     21 }
    ,{  74000,     59,     42,     30,     27,     21 }
    ,{  75000,     60,     43,     30,     27,     21 }
    ,{  76000,     61,     43,     30,     27,     22 }
    ,{  77000,     62,     44,     31,     28,     22 }
    ,{  78000,     62,     44,     31,     28,     22 }
    ,{  79000,     63,     45,     32,     29,     22 }
    ,{  80000,     64,     45,     32,     29,     23 }
    ,{  81000,     65,     46,     32,     29,     23 }
    ,{  82000,     66,     46,     33,     30,     23 }
    ,{  83000,     66,     47,     33,     30,     23 }
    ,{  84000,     67,     47,     33,     30,     24 }
    ,{  85000,     68,     48,     34,     31,     24 }
    ,{  86000,     69,     49,     34,     31,     24 }
    ,{  87000,     69,     49,     35,     31,     24 }
    ,{  88000,     70,     50,     35,     32,     25 }
    ,{  89000,     71,     50,     35,     32,     25 }
    ,{  90000,     72,     51,     36,     32,     25 }
    ,{  91000,     73,     51,     36,     33,     25 }
    ,{  92000,     73,     52,     36,     33,     26 }
    ,{  93000,     74,     52,     37,     33,     26 }
    ,{  94000,     75,     53,     37,     34,     26 }
    ,{  95000,     76,     53,     38,     34,     27 }
    ,{  96000,     76,     54,     38,     34,     27 }
    ,{  97000,     77,     55,     38,     35,     27 }
    ,{  98000,     78,     55,     39,     35,     27 }
    ,{  99000,     79,     56,     39,     35,     28 }
    ,{ 100000,     80,     56,     39,     36,     28 }
    ,{ 101000,     80,     57,     40,     36,     28 }
    ,{ 102000,     81,     57,     40,     36,     28 }
    ,{ 103000,     82,     58,     41,     37,     29 }
    ,{ 104000,     83,     58,     41,     37,     29 }
    ,{ 105000,     84,     59,     41,     37,     29 }
    ,{ 106000,     84,     59,     42,     38,     29 }
    ,{ 107000,     85,     60,     42,     38,     30 }
    ,{ 108000,     86,     61,     43,     38,     30 }
    ,{ 109000,     87,     61,     43,     39,     30 }
    ,{ 110000,     87,     62,     43,     39,     31 }
    ,{ 111000,     88,     62,     44,     39,     31 }
    ,{ 112000,     89,     63,     44,     40,     31 }
    ,{ 113000,     90,     63,     44,     40,     31 }
    ,{ 114000,     91,     64,     45,     40,     32 }
    ,{ 115000,     91,     64,     45,     41,     32 }
    ,{ 116000,     92,     65,     46,     41,     32 }
    ,{ 117000,     93,     65,     46,     41,     32 }
    ,{ 118000,     94,     66,     46,     42,     33 }
    ,{ 119000,     94,     67,     47,     42,     33 }
    ,{ 120000,     95,     67,     47,     43,     33 }
    ,{ 121000,     96,     68,     47,     43,     33 }
    ,{ 122000,     97,     68,     48,     43,     34 }
    ,{ 123000,     98,     69,     48,     44,     34 }
    ,{ 124000,     98,     69,     49,     44,     34 }
    ,{ 125000,     99,     70,     49,     44,     34 }
    ,{ 126000,    100,     70,     49,     45,     35 }
    ,{ 127000,    101,     71,     50,     45,     35 }
    ,{ 128000,    101,     71,     50,     45,     35 }
    ,{ 129000,    102,     72,     51,     46,     36 }
    ,{ 130000,    103,     73,     51,     46,     36 }
}; 


/*--------------------------------------------------------------*
 * BC2 TM Tables with granularity 1G end                        *
 *--------------------------------------------------------------*/
 /*---------------------------------------------------------------------------------------------------
 *    global data start
 *---------------------------------------------------------------------------------------------------*/
PRV_CPSS_RXDMA_IfWidth_ENT              prvSpeed_2_rxDmaIFWidth_ARR             [CPSS_PORT_SPEED_NA_E];
PRV_CPSS_TxFIFO_OutGoungBusWidth_ENT    prvSpeed_2_txFifoOutGoungBusWidth_ARR   [CPSS_PORT_SPEED_NA_E];

GT_U32                                  prvSpeed_2_ethTxFifoShifterThreshold_ARR[CPSS_PORT_SPEED_NA_E];
PRV_CPSS_EthTxFIFO_OutGoungBusWidth_ENT prvSpeed_2_ethTxFifoOutGoungBusWidth_ARR[CPSS_PORT_SPEED_NA_E];



GT_U32 prvCpssDxChBcat2_B0_PortResources_CoreClockIdxGet
(
    IN   GT_U32                          coreClock
)
{
    GT_U32 coreClockIdx;
    GT_U32 i;
    /* find idx of core clock in all GENERATED tables */
    coreClockIdx = (GT_U32)~0;
    for (i = 0 ; i < sizeof(prv_coreClockPlaceArr)/sizeof(prv_coreClockPlaceArr[0]); i ++)
    {
        if (prv_coreClockPlaceArr[i].real_coreClockMHz == coreClock)
        {
            coreClockIdx = i+1;
            break;
        }
    }
    return coreClockIdx;
}

GT_U32 prvCpssDxChBcat2_B0_PortResources_SpeedIdxGet
(
    IN   CPSS_PORT_SPEED_ENT  speed,
    OUT  GT_U32              *speedMbpsPtr
)
{
    GT_U32 i;
    GT_U32 speedIdx;
    GT_U32 speedMbps;

    speedIdx  = (GT_U32)~0;
    speedMbps = (GT_U32)~0;
    for (i = 0 ; i < sizeof(prv_speedPlaceArr)/sizeof(prv_speedPlaceArr[0]); i ++)
    {
        if (prv_speedPlaceArr[i].speedEnm == speed)
        {
            speedIdx = i+1;
            speedMbps = prv_speedPlaceArr[i].computation_speed;
            break;
        }
    }
    *speedMbpsPtr = speedMbps;
    return speedIdx;
}




GT_STATUS prvCpssDxChBcat2_B0_Port_ResourcesCompute
(
    IN  GT_U8                           devNum,
    IN  GT_PHYSICAL_PORT_NUM            portNum,
    IN  CPSS_PORT_INTERFACE_MODE_ENT    ifMode,
    IN  CPSS_PORT_SPEED_ENT             speed,
    IN  GT_U32                          coreClock,
    OUT CPSS_DXCH_BCAT2_PORT_RESOURCE_LIST_STC  *resConfigPtr
)
{
    GT_STATUS rc;
    GT_U32 speedIdx;
    GT_U32 coreClockIdx;
    GT_U32 speedMbps;

    CPSS_DXCH_DETAILED_PORT_MAP_STC *portMapShadowPtr;

    PRV_CPSS_DXCH_DEV_CHECK_MAC(devNum);
    PRV_CPSS_NOT_APPLICABLE_DEV_CHECK_MAC(devNum, CPSS_CH1_E | CPSS_CH1_DIAMOND_E
                                            | CPSS_CH2_E | CPSS_CH3_E | CPSS_XCAT_E | CPSS_XCAT3_E
                                            | CPSS_LION_E | CPSS_LION2_E | CPSS_XCAT2_E);
    CPSS_NULL_PTR_CHECK_MAC(resConfigPtr);
    
    UNUSED_PARAMETER(ifMode);

    PRV_DXCH_BCAT2_RESOURCE_LIST_Init(resConfigPtr);



    rc = prvCpssDxChPortPhysicalPortMapShadowDBGet(devNum, portNum, /*OUT*/&portMapShadowPtr);
    if(rc != GT_OK)
    {
        return rc;
    }

    if (portMapShadowPtr->valid == GT_FALSE)
    {
        CPSS_LOG_ERROR_AND_RETURN_MAC(GT_BAD_PARAM, LOG_ERROR_NO_MSG);
    }

    /* find idx of core clock in all GENERATED tables */
    coreClockIdx = prvCpssDxChBcat2_B0_PortResources_CoreClockIdxGet(coreClock);
    if (coreClockIdx == (GT_U32)~0)
    {
        CPSS_LOG_ERROR_AND_RETURN_MAC(GT_NOT_SUPPORTED, LOG_ERROR_NO_MSG);
    }

    if (speed == CPSS_PORT_SPEED_10_E || speed == CPSS_PORT_SPEED_100_E)
    {
        speed = CPSS_PORT_SPEED_1000_E;
    }
    speedIdx = prvCpssDxChBcat2_B0_PortResources_SpeedIdxGet(speed,/*OUT*/&speedMbps);
    /* find idx of speed in all GENERATED tables */
    if (speedIdx == (GT_U32)~0)
    {
        CPSS_LOG_ERROR_AND_RETURN_MAC(GT_NOT_SUPPORTED, LOG_ERROR_NO_MSG);
    }

    /*----------------------------------------------------------------------------
     * Rx-DMA 
     *    BC2_PORT_FLD_RXDMA_IfWidth 
     *----------------------------------------------------------------------------*/
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_RXDMA_IfWidth, portMapShadowPtr->portMap.rxDmaNum, prvSpeed_2_rxDmaIFWidth_ARR[speed]);
    if (portMapShadowPtr->portMap.trafficManagerEn == GT_FALSE)
    {
        /*----------------------------------------------------------------------------
         *  Tx-DMA 
         *      BC2_PORT_FLD_TXDMA_SCDMA_TxQDescriptorCredit         
         *      BC2_PORT_FLD_TXDMA_SCDMA_burstAlmostFullThreshold    
         *      BC2_PORT_FLD_TXDMA_SCDMA_burstFullThreshold          
         *      BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOHeaderCreditThreshold 
         *      BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOPayloadCreditThreshold
         *------------------------------------------------------------------------------*/
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxQDescriptorCredit,          portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_TxQDescriptorCredit_Arr          [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_burstAlmostFullThreshold,     portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_burstAlmostFullThreshold_Arr     [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_burstFullThreshold,           portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_burstFullThreshold_Arr           [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOHeaderCreditThreshold,  portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_TxFIFOHeaderCreditThreshold_Arr  [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOPayloadCreditThreshold, portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_TxFIFOPayloadCreditThreshold_Arr [coreClockIdx][speedIdx]);
        /*--------------------------------------------------------
        *  Tx-FIFO 
        *      BC2_PORT_FLD_TXFIFO_IfWidth                          
        *      BC2_PORT_FLD_TXFIFO_payloadThreshold           
        *--------------------------------------------------------*/
        if (portMapShadowPtr->portMap.mappingType != CPSS_DXCH_PORT_MAPPING_TYPE_CPU_SDMA_E)
        {
            PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_IfWidth,           portMapShadowPtr->portMap.txFifoPortNum, prvSpeed_2_txFifoOutGoungBusWidth_ARR[speed]);
        }
        else /* CPU (DMA-72) has 8B out-going bus width  */
        {
            PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_IfWidth,           portMapShadowPtr->portMap.txFifoPortNum, PRV_CPSS_TxFIFO_OutGoungBusWidth_8B_E);
        }
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_payloadThreshold,  portMapShadowPtr->portMap.txFifoPortNum, TXFIFO_SCDMA_PayloadStartTransmThreshold_Arr[coreClockIdx][speedIdx]);
    }
    else
    {
#if 0
        PRV_CPSS_DXCH_PP_PORT_GROUPS_INFO_STC * portGroupsExtraInfoPtr = &PRV_CPSS_DXCH_PP_MAC(devNum)->portGroupsExtraInfo;
        GT_U32 tm_txDmaNum  = PRV_CPSS_DXCH_PORT_NUM_TM_TxDMA_CNS;
        GT_U32 tm_txFifoNum = PRV_CPSS_DXCH_PORT_NUM_TM_TxQ_CNS;
        GT_U32 tm_newCumBWMBps = portGroupsExtraInfoPtr->groupResorcesStatus.trafficManagerCumBWMbps + speedMbps; 
#endif

        /*--------------------------------------------------------
        *  Eth-Tx-FIFO
        *      BC2_PORT_FLD_Eth_TXFIFO_IfWidth                      
        *      BC2_PORT_FLD_Eth_TXFIFO_shifterThreshold             
        *      BC2_PORT_FLD_Eth_TXFIFO_payloadThreshold             
        *  use rxDMA in the mapping for EthTxFifo mapping
        *--------------------------------------------------------*/
        if (portMapShadowPtr->portMap.mappingType == CPSS_DXCH_PORT_MAPPING_TYPE_ETHERNET_MAC_E)
        {
            GT_U32 ethTxFifoMapping = portMapShadowPtr->portMap.rxDmaNum;
            PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr, BC2_PORT_FLD_Eth_TXFIFO_IfWidth,          ethTxFifoMapping, prvSpeed_2_ethTxFifoOutGoungBusWidth_ARR[speed]);
            PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr, BC2_PORT_FLD_Eth_TXFIFO_shifterThreshold, ethTxFifoMapping, prvSpeed_2_ethTxFifoShifterThreshold_ARR[speed]);
            PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr, BC2_PORT_FLD_Eth_TXFIFO_payloadThreshold, ethTxFifoMapping, ETH_TXFIFO_SCDMA_PayloadStartTransmThreshold_Arr[coreClockIdx][speedIdx]);
        }
#if 0
        /*----------------------------------------------
        * Configure Traffic Manager 
        *-----------------------------------------------
        *  Tx-DMA (&3)
        *      BC2_PORT_FLD_TXDMA_SCDMA_TxQDescriptorCredit         
        *      BC2_PORT_FLD_TXDMA_SCDMA_burstAlmostFullThreshold    
        *      BC2_PORT_FLD_TXDMA_SCDMA_burstFullThreshold          
        *      BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOHeaderCreditThreshold 
        *      BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOPayloadCreditThreshold
        *------------------------------------------------------------------------------*/
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxQDescriptorCredit,          tm_txDmaNum, TXDMA_SCDMA_TxQDescriptorCredit_Arr          [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_burstAlmostFullThreshold,     tm_txDmaNum, TXDMA_SCDMA_burstAlmostFullThreshold_Arr     [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_burstFullThreshold,           tm_txDmaNum, TXDMA_SCDMA_burstFullThreshold_Arr           [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOHeaderCreditThreshold,  tm_txDmaNum, TXDMA_SCDMA_TxFIFOHeaderCreditThreshold_Arr  [coreClockIdx][speedIdx]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOPayloadCreditThreshold, tm_txDmaNum, TXDMA_SCDMA_TxFIFOPayloadCreditThreshold_Arr [coreClockIdx][speedIdx]);
        /*--------------------------------------------------------
        *  Tx-FIFO (64)
        *      BC2_PORT_FLD_TXFIFO_IfWidth                          
        *      BC2_PORT_FLD_TXFIFO_payloadThreshold           
        *--------------------------------------------------------*/
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_IfWidth,           tm_txFifoNum, prvSpeed_2_txFifoOutGoungBusWidth_ARR[speed]);
        PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_payloadThreshold,  tm_txFifoNum, TXFIFO_SCDMA_PayloadStartTransmThreshold_Arr[coreClockIdx][speedIdx]);
#endif
    }
    return GT_OK;
}



/*--------------------------------------------------------------------------------------* 
 *  find at least one port connected to TM                                              *
 *  if there is no ports mapped to TM, the determination of TM bandwidth is meaningless *
 *--------------------------------------------------------------------------------------*/
GT_STATUS prvCpssDxChBC2TmAnyPortGet
(
    IN   GT_U8 devNum,
    OUT  GT_PHYSICAL_PORT_NUM *portNumPtr
)
{
    GT_STATUS rc;
    GT_PHYSICAL_PORT_NUM portNum;
    CPSS_DXCH_DETAILED_PORT_MAP_STC *portMapShadowPtr;

    for(portNum = 0; portNum < PRV_CPSS_DXCH_MAX_PHY_PORT_NUMBER_MAC(devNum); portNum++)
    {
        rc = prvCpssDxChPortPhysicalPortMapShadowDBGet(devNum, portNum, /*OUT*/&portMapShadowPtr);
        if(rc != GT_OK)
        {
            CPSS_LOG_ERROR_AND_RETURN_MAC(rc,"cpssDxChPortResourceTmBandwidthSet: error in prvCpssDxChPortPhysicalPortMapShadowDBGet for port = %d\n", portNum);
        }
        if((portMapShadowPtr->valid == GT_TRUE) && (portMapShadowPtr->portMap.trafficManagerEn == GT_TRUE))
        {
            *portNumPtr = portNum;
            return GT_OK;
        }
    }
    CPSS_LOG_ERROR_AND_RETURN_MAC(GT_BAD_STATE,"cpssDxChPortResourceTmBandwidthSet: there are no ports connected to TM\n");
}

GT_STATUS prvCpssDxChBcat2_B0_TM_ResourcesCompute
(
    IN  GT_U8                           devNum,
    IN  GT_U32                          coreClock,
    IN  GT_U32                          speedMbps,
    OUT CPSS_DXCH_BCAT2_PORT_RESOURCE_LIST_STC  *resConfigPtr
)
{
    GT_STATUS rc;
    GT_U32 speedIdx;
    GT_U32 coreClockIdx;
    GT_PHYSICAL_PORT_NUM portNum;

    CPSS_DXCH_DETAILED_PORT_MAP_STC *portMapShadowPtr;

    PRV_CPSS_DXCH_DEV_CHECK_MAC(devNum);
    PRV_CPSS_NOT_APPLICABLE_DEV_CHECK_MAC(devNum, CPSS_CH1_E | CPSS_CH1_DIAMOND_E
                                            | CPSS_CH2_E | CPSS_CH3_E | CPSS_XCAT_E | CPSS_XCAT3_E
                                            | CPSS_LION_E | CPSS_LION2_E | CPSS_XCAT2_E);
    CPSS_NULL_PTR_CHECK_MAC(resConfigPtr);
    

    PRV_DXCH_BCAT2_RESOURCE_LIST_Init(resConfigPtr);
    
    /* find first port with TM */
    rc = prvCpssDxChBC2TmAnyPortGet(devNum,&portNum);
    if(rc != GT_OK)
    {
        return rc;
    }

    rc = prvCpssDxChPortPhysicalPortMapShadowDBGet(devNum, portNum, /*OUT*/&portMapShadowPtr);
    if(rc != GT_OK)
    {
        return rc;
    }

    /* find idx of core clock in all GENERATED tables */
    coreClockIdx = prvCpssDxChBcat2_B0_PortResources_CoreClockIdxGet(coreClock);
    if (coreClockIdx == (GT_U32)~0)
    {
        CPSS_LOG_ERROR_AND_RETURN_MAC(GT_NOT_SUPPORTED, LOG_ERROR_NO_MSG);
    }

    if (speedMbps == 0)
    {
        CPSS_LOG_ERROR_AND_RETURN_MAC(GT_BAD_PARAM, LOG_ERROR_NO_MSG);
    }
    speedIdx = speedMbps/1000;
    /*----------------------------------------------------------------------------
        *  Tx-DMA 
        *      BC2_PORT_FLD_TXDMA_SCDMA_TxQDescriptorCredit         
        *      BC2_PORT_FLD_TXDMA_SCDMA_burstAlmostFullThreshold    
        *      BC2_PORT_FLD_TXDMA_SCDMA_burstFullThreshold          
        *      BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOHeaderCreditThreshold 
        *      BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOPayloadCreditThreshold
        *------------------------------------------------------------------------------*/
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxQDescriptorCredit,          portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_TxQDescriptorCredit_gran_1G_Arr         [speedIdx][coreClockIdx]);
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_burstAlmostFullThreshold,     portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_burstAlmostFullThreshold_gran_1G_Arr    [speedIdx][coreClockIdx]);
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_burstFullThreshold,           portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_burstFullThreshold_gran_1G_Arr          [speedIdx][coreClockIdx]);
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOHeaderCreditThreshold,  portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_TxFIFOHeaderCreditThreshold_gran_1G_Arr [speedIdx][coreClockIdx]);
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXDMA_SCDMA_TxFIFOPayloadCreditThreshold, portMapShadowPtr->portMap.txDmaNum, TXDMA_SCDMA_TxFIFOPayloadCreditThreshold_gran_1G_Arr[speedIdx][coreClockIdx]);
    /*--------------------------------------------------------
    *  Tx-FIFO 
    *      BC2_PORT_FLD_TXFIFO_IfWidth            shall be 64Bytes  since TM is configured for that width;
    *      BC2_PORT_FLD_TXFIFO_payloadThreshold           
    *--------------------------------------------------------*/
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_IfWidth,           portMapShadowPtr->portMap.txFifoPortNum, PRV_CPSS_TxFIFO_OutGoungBusWidth_64B_E);
    PRV_DXCH_BCAT2_RESOURCE_LIST_Append(resConfigPtr,BC2_PORT_FLD_TXFIFO_payloadThreshold,  portMapShadowPtr->portMap.txFifoPortNum, TXFIFO_SCDMA_PayloadStartTransmThreshold_gran_1G_Arr[speedIdx][coreClockIdx]);
    return GT_OK;
}

typedef struct 
{
    CPSS_PORT_SPEED_ENT                      speed;
    PRV_CPSS_RXDMA_IfWidth_ENT               rxDmaIfWidth;
    PRV_CPSS_TxFIFO_OutGoungBusWidth_ENT     txFifoOutGoingBusWidth;
    GT_U32                                   ethTxFifoShifterThreshold;
    PRV_CPSS_EthTxFIFO_OutGoungBusWidth_ENT  ethTxFifoOutGoingBusWidth;
}PRV_CPSS_DXCH_BC2_SPEED_2_RES_STC;


static PRV_CPSS_DXCH_BC2_SPEED_2_RES_STC prv_bc2_B0_speed2resourceInitList[] = 
{
      { CPSS_PORT_SPEED_10_E    ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_1B_E  ,            2 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_1B_E  }
     ,{ CPSS_PORT_SPEED_100_E   ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_1B_E  ,            2 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_1B_E  }
     ,{ CPSS_PORT_SPEED_1000_E  ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_1B_E  ,            2 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_1B_E  }
     ,{ CPSS_PORT_SPEED_2500_E  ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_8B_E  ,            3 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_8B_E  }
     ,{ CPSS_PORT_SPEED_5000_E  ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_8B_E  ,            3 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_8B_E  }
     ,{ CPSS_PORT_SPEED_10000_E ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_8B_E  ,            3 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_8B_E  }
     ,{ CPSS_PORT_SPEED_11800_E ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_8B_E  ,            3 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_8B_E  }
     ,{ CPSS_PORT_SPEED_20000_E ,  PRV_CPSS_RXDMA_IfWidth_64_E  , PRV_CPSS_TxFIFO_OutGoungBusWidth_8B_E  ,            4 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_8B_E  }
     ,{ CPSS_PORT_SPEED_40000_E ,  PRV_CPSS_RXDMA_IfWidth_256_E , PRV_CPSS_TxFIFO_OutGoungBusWidth_32B_E ,            4 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_32B_E }
     ,{ CPSS_PORT_SPEED_47200_E ,  PRV_CPSS_RXDMA_IfWidth_256_E , PRV_CPSS_TxFIFO_OutGoungBusWidth_32B_E ,            4 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_32B_E }
     ,{ CPSS_PORT_SPEED_100G_E  ,  PRV_CPSS_RXDMA_IfWidth_512_E , PRV_CPSS_TxFIFO_OutGoungBusWidth_64B_E ,            4 , PRV_CPSS_EthTxFIFO_OutGoungBusWidth_64B_E }
     ,{ CPSS_PORT_SPEED_NA_E    ,  PRV_CPSS_RXDMA_IfWidth_MAX_E , PRV_CPSS_TxFIFO_OutGoungBusWidth_MAX_E ,  (GT_U32)(~0), PRV_CPSS_EthTxFIFO_OutGoungBusWidth_MAX_E }
};



GT_STATUS prvCpssDxChBcat2B0ResourcesTablesInit
(
    IN    GT_U8                   devNum
)
{
    GT_U32 i;

    PRV_CPSS_DXCH_DEV_CHECK_MAC(devNum);
    /* prvCpssDxChBcat2Resourses[CPSS_PORT_SPEED_NA_E][PRV_BC2_CORE_CLOCK_MAX_IDX_E] =  */

    PRV_CPSS_NOT_APPLICABLE_DEV_CHECK_MAC(devNum, CPSS_CH1_E | CPSS_CH1_DIAMOND_E |
                                                  CPSS_CH2_E | CPSS_CH3_E | CPSS_XCAT_E |
                                                  CPSS_XCAT3_E | CPSS_LION_E | CPSS_LION2_E |CPSS_XCAT2_E);


    for (i = 0 ; i < CPSS_PORT_SPEED_NA_E; i++)
    {
        prvSpeed_2_rxDmaIFWidth_ARR[i]              = PRV_CPSS_DXCH_INVALID_RESOURCE_CNS;
        prvSpeed_2_txFifoOutGoungBusWidth_ARR[i]    = PRV_CPSS_DXCH_INVALID_RESOURCE_CNS;
        prvSpeed_2_ethTxFifoShifterThreshold_ARR[i] = PRV_CPSS_DXCH_INVALID_RESOURCE_CNS;
        prvSpeed_2_ethTxFifoOutGoungBusWidth_ARR[i] = PRV_CPSS_DXCH_INVALID_RESOURCE_CNS;
    }
    for (i = 0 ; prv_bc2_B0_speed2resourceInitList[i].speed != CPSS_PORT_SPEED_NA_E; i++)
    {
        prvSpeed_2_rxDmaIFWidth_ARR             [prv_bc2_B0_speed2resourceInitList[i].speed] = prv_bc2_B0_speed2resourceInitList[i].rxDmaIfWidth;
        prvSpeed_2_txFifoOutGoungBusWidth_ARR   [prv_bc2_B0_speed2resourceInitList[i].speed] = prv_bc2_B0_speed2resourceInitList[i].txFifoOutGoingBusWidth;
        prvSpeed_2_ethTxFifoShifterThreshold_ARR[prv_bc2_B0_speed2resourceInitList[i].speed] = prv_bc2_B0_speed2resourceInitList[i].ethTxFifoShifterThreshold;
        prvSpeed_2_ethTxFifoOutGoungBusWidth_ARR[prv_bc2_B0_speed2resourceInitList[i].speed] = prv_bc2_B0_speed2resourceInitList[i].ethTxFifoOutGoingBusWidth;
    }
    return GT_OK;
}
